;    VashOS - Bootloader
;    Copyright (C) 2025  Vekaris Wesion
;
;    This program is free software: you can redistribute it and/or modify
;    it under the terms of the GNU General Public License as published by
;    the Free Software Foundation, either version 3 of the License, or
;    (at your option) any later version.
;
;    This program is distributed in the hope that it will be useful,
;    but WITHOUT ANY WARRANTY; without even the implied warranty of
;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;    GNU General Public License for more details.
;
;    You should have received a copy of the GNU General Public License
;    along with this program.  If not, see <https://www.gnu.org/licenses/>.

bits 16
org 0x7c00

start:
    mov ax, cs
    mov ds, ax
    mov es, ax        ; 初始化es=cs
    call clear
    call say_hello
    jmp $

clear:
    mov ax, 0x0600   ; 清屏功能
    mov bh, 0x07     ; 黑底白字
    xor cx, cx       ; 左上角(0,0)
    mov dx, 0x184f   ; 右下角(24,79)
    int 0x10
    ; 重置光标
    mov ah, 0x02
    xor dx, dx       ; (0,0)
    xor bh, bh       ; 页面0
    int 0x10
    ret

say_hello:
    mov ax, 0x1301   ; 写字符串功能
    mov bp, Msg      ; es:bp=字符串地址
    mov cx, MsgLen   ; 字符串长度
    mov bl, 0x0c     ; 黑底亮红字
    xor dx, dx       ; 起始位置(0,0)
    int 0x10
    ret

Msg db "Hello, World!", 0
MsgLen equ $ - Msg   ; 正确计算长度

times 510 - ($ - $$) db 0
dw 0xaa55
